import React from 'react'
import { Button, Select, Form, Input } from 'antd';
import { GetUserLevel } from '@/apis/user';

const { Option } = Select;

type Props = {
    search: (list: any) => void
}

const SearchLevel = ({ search }: Props) => {
    const onFinish = async (values: any) => {
        console.log(values);
        const res: any = await GetUserLevel(values)
        search(res.data)
    };

    const onFinishFailed = (errorInfo: any) => {
        console.log('Failed:', errorInfo);
    };

    return (
        <Form layout='inline' name="basic" style={{ marginBottom: '20px' }} onFinish={onFinish} onFinishFailed={onFinishFailed}>
            <Form.Item label="状态" name="is_show">
                <Select placeholder='请选择' style={{ width: '200px', marginRight: '20px' }} >
                    <Option value='1'>显示</Option>
                    <Option value='0'>不显示</Option>
                </Select>
            </Form.Item>

            <Form.Item label="等级名称" name="name">
                <Input />
            </Form.Item>

            <Form.Item >
                <Button type="primary" htmlType="submit">
                    搜索
                </Button>
            </Form.Item>
        </Form>
    )
}

export default SearchLevel